
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 1231. -- [Usaco2008 Nov]mixup2 混乱的奶牛 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>1231: [Usaco2008 Nov]mixup2 混乱的奶牛</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>162 MB<br><span class=green>Submit: </span>297&nbsp;&nbsp;<span class=green>Solved: </span>164<br>[<a href='submitpage.php?id=1231'>Submit</a>][<a href='problemstatus.php?id=1231'>Status</a>][<a href='bbs.php?id=1231'>Discuss</a>]</center><h2>Description</h2><div class=content>混乱的奶牛 [Don Piele, 2007]

Farmer John的N(4 <= N <= 16)头奶牛中的每一头都有一个唯一的编号S_i
(1 <= S_i <= 25,000). 奶牛为她们的编号感到骄傲, 所以每一头奶牛都把她的编号刻在一个
金牌上, 并且把金牌挂在她们宽大的脖子上.

奶牛们对在挤奶的时候被排成一支"混乱"的队伍非常反感. 如果一个队伍里任意两头相邻的奶牛的
编号相差超过K (1 <= K <= 3400), 它就被称为是混乱的. 比如说，当N = 6, K = 1时,
1, 3, 5, 2, 6, 4 就是一支"混乱"的队伍, 但是 1, 3, 6, 5, 2, 4 不是(因为5和6只
相差1).
那么, 有多少种能够使奶牛排成"混乱"的队伍的方案呢?

</div><h2>Input</h2><div class=content>* 第 1 行: 用空格隔开的两个整数N和K
* 第 2..N+1 行: 第i+1行包含了一个用来表示第i头奶牛的编号的整数: S_i
</div><h2>Output</h2><div class=content>第 1 行: 只有一个整数, 表示有多少种能够使奶牛排成"混乱"的队伍的方案. 答案保证是
             一个在64位范围内的整数.
</div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>4 1<br />
3<br />
4<br />
2<br />
1<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>2<br />
<br />
输出解释:<br />
<br />
两种方法分别是:<br />
3 1 4 2<br />
2 4 1 3<br />
</span></div><h2>HINT</h2>
			<div class=content><p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Gold'>Gold</a></p></div><center>[<a href='submitpage.php?id=1231'>Submit</a>][<a href='problemstatus.php?id=1231'>Status</a>][<a href='bbs.php?id=1231'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
